package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.GxDatabase;
import com.ruoyi.system.service.IQuartzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: lsn
 * @ClassName: GxDateManageController
 * @Description:
 * @Data: 2023/8/30 13:50
 **/
@RestController
@RequestMapping("/system/dataManage")
public class GxDateManageController extends BaseController {

    @Autowired
    IQuartzService quartzService;

//    @GetMapping("backup")
//    public AjaxResult backup() {
//        quartzService.mysqlBackupTask();
//        return AjaxResult.success();
//    }

    @PostMapping("backup")
    public AjaxResult backup(@RequestBody GxDatabase database) {
        GxDatabase gxDatabase = quartzService.mysqlBackupTask(database);
        return AjaxResult.success(gxDatabase);
    }

    @PostMapping("recovery")
    public AjaxResult recovery(@RequestBody GxDatabase database) {
        GxDatabase gxDatabase = quartzService.mysqlRecoveryTask(database);
        return AjaxResult.success(gxDatabase);
    }
}
